﻿Public Class ClsAction
    'represents action

#Region "Attributes"
#Region "Private attributes"
    Private MeAction As GeAction = GeAction.kkNoAction 'action of action object
    Private MoData As Collection = New Collection 'data for action
    Private MoOriginalCursor As Cursor 'original cursor before action is running
#End Region
#End Region
#Region "Constructors"
    Sub New(ByVal IeAction As GeAction)
        MeAction = IeAction
        'remember original cursor
        MoOriginalCursor = Cursor.Current
        Cursor.Current = Cursors.WaitCursor
    End Sub
#End Region
#Region "Destructors"
    Protected Overrides Sub Finalize()
        MyBase.Finalize()
        MeAction = GeAction.kkNoAction
        MoData.Clear()
        'set back original cursor
        Cursor.Current = MoOriginalCursor
    End Sub
#End Region
#Region "Properties"
#Region "Public attributes"
    Public Property Action() As GeAction
        Get
            Return MeAction
        End Get
        Set(ByVal IeValue As GeAction)
            MeAction = IeValue
        End Set
    End Property
#End Region
#End Region
#Region "Subs"
    'sets data for action
    Public Sub SetData(ByRef OoObject As Object, ByVal IsKey As String)
        If IsInCollection(MoData, IsKey) Then
            MoData.Remove(IsKey)
        End If
        MoData.Add(OoObject, IsKey)
    End Sub
#End Region
#Region "Functions"
    'gets data of action
    Public Function GetData(ByVal IsKey As String) As Object
        Return MoData(IsKey)
    End Function
    'is key in collection?
    Public Function IsInCollectionOfAction(ByVal IsKey As String) As Boolean
        Return IsInCollection(MoData, IsKey)
    End Function
#End Region
End Class
